package com.ayou.eggguard.farm.mapper;

import com.ayou.eggguard.farm.pojo.Vaccine;
import com.ayou.eggguard.farm.pojo.VaccineRecord;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface VaccineMapper {
    List<Vaccine> getVaccines(String vaccineNumber);

    @Insert("insert into vaccine(vaccine_name, vaccine_number, vaccine_firm, inject_time, dose,vaccine_use) " +
            "values(#{vaccineName},#{vaccineNumber},#{vaccineFirm},#{injectTime},#{dose},#{vaccineUse})")
    void add(Vaccine vaccine);



    @Delete("delete from vaccine where id=#{id}")
    void delete(Integer id);

    @Update("update vaccine set vaccine_name=#{vaccineName},vaccine_number=#{vaccineNumber}," +
            "vaccine_firm=#{vaccineFirm},inject_time=#{injectTime},dose=#{dose}," +
            "vaccine_use=#{vaccineUse} " +
            "where id=#{id}")
    void update(Vaccine vaccine);

    @Select("select * from vaccinerecord where coop_number=#{coopNumber}")
    List<VaccineRecord> getVaccineRecordList(String coopNumber);
}
